// 加载请求拦截器
import axios from "axios";
import { useTokenStore } from "@/stores/token";
const instance = axios.create({
  baseURL: "http://localhost:5173",
  timeout: 5000
});


instance.interceptors.request.use( config => {
  const token = useTokenStore()

  if (!config.url?.includes("/login/")) {
    // 添加token
    config.headers.Authorization = `Token ${token.token.token}`;
  }
  return config;
})

export default instance;
